#ifndef FILEWRITER_H
#define FILEWRITER_H

#include <QThread>
#include <QFile>
#include <QMutex>
#include <QQueue>

class FileWriter : public QThread {
    Q_OBJECT
public:
    explicit FileWriter(QObject *parent = nullptr);
    ~FileWriter();

    void stopWriting();

public slots:
    void enqueueNalu(const QByteArray &nalu);


protected:
    void run() override;

private:
    QFile m_file;
    QQueue<QByteArray> m_naluQueue;
    QMutex m_queueMutex;
    bool m_running = true;
};

#endif // FILEWRITER_H
